package app.game;

import app.game.enums.Direction;
import app.ui.Config;

/**
 * @Description TODO
 * @Date 2022/4/17 20:58
 * @Created by LYP
 */
public class ChessPoint {
    private int x;
    private int y;

    public ChessPoint(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public ChessPoint getNext(Direction d, int pos) {
        return new ChessPoint(this.x + pos * d.getX(), this.y + pos * d.getY());
    }

    public void next(Direction d, int pos) {
        this.x += pos * d.getX();
        this.y += pos * d.getY();
    }

    public boolean isOnTable() {
        return x >= 0 && x < Config.BOARD_LINE && y >= 0 && y < Config.BOARD_LINE;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }
}
